﻿@inherits BaseComponent

<div id="editor_@Id">
    <textarea name="@Id" style="display:none;">@Value</textarea>
</div>
<div class="tip">包括但不限于代码、错误信息等（请勿上传代码的截图，截图无法调试），编辑器支持 Markdown 语法。</div>

<script>
    $(function () {
        var editor = editormd('editor_@Id', {
            width: '100%',
            height: @Height,
            syncScrolling: 'single',
            path: '_content/CodeWF/lib/',
            placeholder: '@Placeholder',
            autoFocus: @AutoFocus.ToString().ToLower(),
            watch: false,
            imageUpload: true,
            imageFormats: ['jpg', 'jpeg', 'gif', 'png', 'bmp', 'webp'],
            imageUploadURL: './File/UploadFile',
            toolbarIcons: function () {
                // Or return editormd.toolbarModes[name]; // full, simple, mini
                // Using "||" set icons align right.
                return ['undo', 'redo', '|', 'list-ul', 'list-ol', '|', 'code', 'code-block', '|', 'link', 'image', '|', 'watch']
            },
        });
        console.log(editor);
    });
</script>

@code {
    [Parameter] public int Height { get; set; } = 300;
    [Parameter] public bool AutoFocus { get; set; }
    [Parameter] public string Value { get; set; }
    [Parameter] public string Placeholder { get; set; }
}